﻿using System;
using System.Collections.Generic;
using Autodesk.Revit.DB;
using Autodesk.Revit.Exceptions;
using Autodesk.Revit.UI;
using YArchitech.Revit.Electric.Common;

namespace HYRElectric.Equipment
{
	internal class LeadSymbolLayout : EquipmentLayout
	{
		public LeadSymbolLayout(UIDocument uiDoc, Document document, DbFamilyObject familyObject, FamilySymbol selectedFamilySymbol, List<BuiltInCategory> lstFilter) : base(uiDoc, document, familyObject, selectedFamilySymbol, lstFilter)
		{
			this.uiDoc = uiDoc;
			this.doc = document;
		}

		public override bool Layout()
		{
			if (!base.Layout())
			{
				return false;
			}
			try
			{
				this.uiDoc.PromptForFamilyInstancePlacement(this.familySymbol);
			}
			catch (Autodesk.Revit.Exceptions.OperationCanceledException)
			{
				return true;
			}
			catch (Exception)
			{
				return false;
			}
			return true;
		}

		private UIDocument uiDoc;
	}
}
